package com.timothy.remote.business;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.timothy.remote.core.UserEntity;

@Controller
@RequestMapping(value = "/client")
public class ClientController {

	@RequiresPermissions("sys:menu:look")
	@RequestMapping(value = "/index.html")
	public String index(ModelMap map) {
		UserEntity userEntity = (UserEntity) SecurityUtils.getSubject().getPrincipal();
		map.put("nickName", userEntity.getNickname());
		return "/client/index.html";
	}

	@RequiresPermissions("sys1:menu:look2")
	@RequestMapping(value = "/index2.html")
	public String indexNoPerms(ModelMap map) {
		UserEntity userEntity = (UserEntity) SecurityUtils.getSubject().getPrincipal();
		map.put("nickName", userEntity.getNickname());
		return "/client/index.html";
	}
}
